package com.tczs.web.action;

import com.alibaba.fastjson.JSONObject;
import com.tczs.web.config.NeedLogin;
import com.tczs.web.service.TableService;
import org.apache.log4j.Logger;

public class TableAction {

    private static Logger logger = Logger.getLogger(TableAction.class);

    /**
     * 寻找当前数据库下的所有表
     * @param method
     * @param databaseName
     * @return
     */
    @NeedLogin
    public JSONObject findTables(String method, String databaseName){
        logger.info("entry findTables.........");
        TableService tableService = new TableService();
        return tableService.findTables(databaseName);
    }

    @NeedLogin
    public JSONObject findTableFields(String method,String databaseName,String tableName){
        logger.info("entry findTableFields.........");
        TableService tableService = new TableService();
        return tableService.findTableField(databaseName,tableName);
    }

    @NeedLogin
    public JSONObject createTable(String method,String databaseName,String tableName,String commandData){
        logger.info("entry createTable.........");
        TableService tableService = new TableService();
        return tableService.createTable(databaseName,tableName,commandData);
    }
}
